//
//  HHSelectUserDemoViewController.m
//  HHChatKit
//
//  Created by Henry on 2021/8/20.
//

#import "HHSelectUserDemoViewController.h"

@interface HHSelectUserDemoViewController ()

@end

@implementation HHSelectUserDemoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"添加成员";
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"关闭" style:UIBarButtonItemStylePlain target:self action:@selector(onClickClose)];
    
    NSMutableArray *arr = [NSMutableArray array];
    for (int i = 0; i < 3; i ++) {
        HHSelectUserModel *model = [[HHSelectUserModel alloc] init];
        model.name = [NSString stringWithFormat:@"姓名-%d", i];
        model.userId = [NSString stringWithFormat:@"1%d", i];
        [arr addObject:model];
    }
    for (int i = 0; i < 3; i ++) {
        HHSelectUserModel *model = [[HHSelectUserModel alloc] init];
        model.name = [NSString stringWithFormat:@"没姓名-%d", i];
        model.userId = [NSString stringWithFormat:@"2%d", i];
        model.isSelected = YES;
        model.unable = YES;
        [arr addObject:model];
    }
    for (int i = 0; i < 3; i ++) {
        HHSelectUserModel *model = [[HHSelectUserModel alloc] init];
        model.name = [NSString stringWithFormat:@"好姓名-%d", i];
        model.userId = [NSString stringWithFormat:@"3%d", i];
        [arr addObject:model];
    }
    
    for (int i = 0; i < 3; i ++) {
        HHSelectUserModel *model = [[HHSelectUserModel alloc] init];
        model.name = [NSString stringWithFormat:@"牛姓名-%d", i];
        model.userId = [NSString stringWithFormat:@"4%d", i];
        [arr addObject:model];
    }
    self.dataArray = arr;
    self.hasIndexSearch = YES;

    [self reloadData];
    [self reloadSelectData];
}

- (void)onClickClose {
    [self dismissViewControllerAnimated:YES completion:nil];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
